package controller.admin;

import java.util.List;

import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;

import controller.admin.base.BaseAdminController;
import enums.ParamConfigId;
import model.ParamConfig;
import service.ParamConfigService;

public class AdminParamConfigController extends BaseAdminController{
    @Inject
    private ParamConfigService paramConfigService;

    //系统参数配置列表
    public void list() {
        List<ParamConfig> list = ParamConfig.dao.listAll();
        renderJson("list", list);
    }
    
    public void info() {
    	String id = getPara("id");
        ParamConfig paramConfig = ParamConfig.dao.findById(id);
        set("data", paramConfig);
        set("list", ParamConfigId.toList());
        renderJson();
	}

    //系统参数配置新增与修改
    public void save() {
    	 ParamConfig paramConfig = getModel(ParamConfig.class , "x");
         Ret ret = paramConfigService.save(paramConfig);
         renderJson(ret);
    }

    //系统参数配置删除
    public void delete() {
        String id = getPara("id");
        Ret ret = paramConfigService.delete(id);
        renderJson(ret);
    }
}